package com.lrkj.back.service.impl;

import java.util.List;
import java.util.Map;

import com.lrkj.back.mapper.ZsPeibaoMapper;
import com.lrkj.back.entity.ZsPeibao;
import com.lrkj.back.service.ZsPeibaoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.com.cbons.mamisay.parent.db.api.DBInterface;
import cn.com.cbons.mamisay.parent.exception.DBException;
import cn.com.cbons.mamisay.parent.service.base.ParentServiceImpl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

@Transactional
@Service("peibaoService")
public class ZsPeibaoServiceImpl extends ParentServiceImpl<ZsPeibao> implements ZsPeibaoService {

    @Autowired
    private ZsPeibaoMapper zsPeibaoMapper;

    @Override
    protected DBInterface<ZsPeibao> getDao() throws DBException {
        return zsPeibaoMapper;
    }

    @Override
    public PageInfo<ZsPeibao> findPeibaoByZTandHG(Map<String, Object> map) throws DBException {
        PageHelper.startPage(Integer.valueOf(map.get("pageNo").toString()),
                Integer.valueOf(map.get("pageSize").toString()));
        List<ZsPeibao> pblist = zsPeibaoMapper.findPeibaoByZTandHG(map);
        PageInfo<ZsPeibao> page = new PageInfo<>(pblist);
        return page;
    }

    @Override
    public void updateZhuangtaiByPK(Map<String, Object> map) throws DBException {
        zsPeibaoMapper.updateZhuangtaiByPK(map);
    }

    @Override
    public PageInfo<ZsPeibao> findAllZsPeibao(Map<String, Object> map) throws DBException {
        PageHelper.startPage(Integer.valueOf(map.get("pageNo").toString()),
                Integer.valueOf(map.get("pageSize").toString()));
        List<ZsPeibao> tbList = zsPeibaoMapper.findAllZsPeibao(map);
        PageInfo<ZsPeibao> page = new PageInfo<>(tbList);
        return page;
    }

    @Override
    public List<ZsPeibao> findAllZsPeibaoNoPage(Map<String, Object> map) throws DBException {
        return zsPeibaoMapper.findAllZsPeibao(map);
    }

    @Override
    public void updateState(Map<String, Object> map) throws DBException {
        zsPeibaoMapper.updateState(map);
    }

    @Override
    public int updateBatch(List<ZsPeibao> list) throws DBException {
        return zsPeibaoMapper.updateBatch(list);
    }

    @Override
    public int insertBatch(List<ZsPeibao> list) throws DBException {
        return zsPeibaoMapper.insertBatch(list);
    }

    @Override
    public int updateBatchByBao(List<ZsPeibao> list) throws DBException {
        // TODO Auto-generated method stub
        return zsPeibaoMapper.updateBatchByBao(list);
    }

}
